package com.ruralflow.service.impl;

import com.ruralflow.domain.vo.ModuleSummaryDataResp;
import com.ruralflow.flow.service.IFlowApplyService;
import com.ruralflow.flow.service.IFlowPassService;
import com.ruralflow.population.domain.Hukou;
import com.ruralflow.population.service.IHukouService;
import com.ruralflow.population.service.IPopulationService;
import com.ruralflow.service.StatisticsService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.function.Supplier;

/**
 * @author bairimengchang
 * @version 1.0
 * @description 数据统计业务接口实现类
 * @date 2025/2/9
 */
@Service
@Slf4j
public class StatisticsServiceImpl implements StatisticsService {

    @Autowired
    private IHukouService hukouService;

    @Autowired
    private IPopulationService populationService;

    @Autowired
    private IFlowApplyService flowApplyService;

    @Autowired
    private IFlowPassService flowPassService;

    /**
     * 获取模块汇总数据
     * @return ModuleSummaryDataResp 概览统计数据响应类
     */
    @Override
    public ModuleSummaryDataResp selectModuleSummaryData() {
        // 获取户口数量
        Integer hukouCount = hukouService.selectCountHukou();
        // 获取流动人口数量
        Integer populationCount = populationService.selectCountPopulation();
        // 获取流动申请数量
        Integer applyCount = flowApplyService.selectCountFlowApply();
        // 获取通行证数量
        Integer passCount = flowPassService.selectCountFlowPass();

        return ModuleSummaryDataResp
                .builder()
                .hukouCount(hukouCount)
                .populationCount(populationCount)
                .applyCount(applyCount)
                .passCount(passCount)
                .build();
    }

}
